<template>
	<view>
		<!-- 投资项目审议审核 -->
		<view class="head_tb">
			<u-tabs :activeStyle="{
						 fontSize:'32rpx',
						 color: '#007aff'
			         }" :inactiveStyle="{
						 fontSize:'30rpx'
			         }" :scrollable='false' :lineWidth='30' itemStyle='height:90rpx;width:33%' :list="list1"
				@click="checkbtn"></u-tabs>
		</view>
			
		<!-- 基本信息 -->
		<view class="msp">
			<CellChild :addlist='addlist' :rows='rows' :fileNo = 'fileNo'  title='基本信息' id='add_one'>
			</CellChild>
		</view>
		<!-- 项目信息 -->
		<view class="formcard" id="add_two">
			<view class="bodtitle">
				<p><b>项目信息</b></p>
			</view>
			
			<view v-for="(item,index) in investEntity" :key="index">
				<Expandlist :cellshows='cellshow' :arrcell='item'  :celllist='celllist1' :title='item.budgetNo'>
					<template #text>
						<p class='solts'><label class="solts_label">￥</label><span class="solts_span" v-money>{{item.reviewAmount}}</span></p>
					</template>
				</Expandlist>
			</view>

		</view>
		
		<!-- 子项目明细 -->
		<view class="formcard" id="add_three">
			<view class="bodtitle">
				<p><b>子项目明细</b></p>
			</view>
			<view class="newbord" v-for="(t,index) in subInfoEntityList">
				<view class="skyblue">
					<span>付款计划金额</span>
					<span>付款预算金额</span>
				</view>
				<view class="sky" v-for="(item,index) in subInfoPayEntityList">
					<span v-money>{{item.payAmount}}</span>
					<span v-money>{{item.payBudgetAmount}}</span>
				</view>
			</view>
			<view v-for="(r,index) in subInfoEntityList" :key="index">
				<Expandlist :cellshows='cellshow' :arrcell='r'  :celllist='celllist' :title='r.sonBudgetNo'>
				</Expandlist>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		components:{
		},
		data() {
			return {
				list1: [{
						name: '基本信息',
					},
					{
						name: '项目信息'
					},
					{
						name: '子项目明细'
					},
				],
				cellshow:true,
				addlist: [{
						tit: '单据编号',
						val: 'billNo'
					},
					{
						tit: '申请人',
						val: 'userDesc'
					},
					{
						tit: '工号',
						val: 'userId'
					},
					{
						tit: '联系电话',
						val: 'phone'
					},
					{
						tit: '提交审议说明',
						val: 'reviewDesc'
					},
				],
				celllist:[
					{tit:'子项目预算编号',val:'sonBudgetNo'},
					{tit:'项目名称',val:'subProName'},
					{tit:'立项金额',val:'budgetAmount',type:'number'},
					{tit:'预算金额',val:'reviewAmount',type:'number'},
					{tit:'提单计划日期',val:'billDate'},
					{tit:'提单执行日期',val:'billExecuteDate'},
					{tit:'提单计划金额',val:'billAmount',type:'number'},
					{tit:'提单预算金额',val:'billBudgetAmount',type:'number'},
					{tit:'合同计划日期',val:'contractDate'},
					{tit:'合同执行日期',val:'contractExecuteDate'},
					{tit:'合同计划金额',val:'contractAmount',type:'number'},
					{tit:'合同预算金额',val:'contractBudgetAmount',type:'number'},
					// {tit:'合计',val:'forwardAmount'},
					// {tit:'科室',val:'subdept'},
					// {tit:'投资大类',val:'catNm'},
					// {tit:'投资小类',val:'subCatNm'},
					// {tit:'立项金额',val:'',type:'number'},
					// {tit:'预算金额',val:'reviewAmount',type:'number'},
					// {tit:'差额',val:'amountDifference',type:'number'}
				],
				celllist1:[
					// {tit:'项目名称',val:'proName'},
					{tit:'预算年度',val:'budgetYear'},
					{tit:'科室',val:'subdeptNm'},
					{tit:'投资大类',val:'catNm'},
					{tit:'投资小类',val:'subCatNm'},
					{tit:'立项金额',val:'budgetAmount',type:'number'},
					// {tit:'预算金额',val:'reviewAmount',type:'number'},
					{tit:'差额',val:'amountDifference',type:'number'},
					// {tit:'立项金额',val:'reviewAmount',type:'number'},
					// {tit:'提单计划日期',val:'billDate'},
					// {tit:'提单执行日期',val:'billExecuteDate'},
					// {tit:'提单计划金额',val:'billAmount',type:'number'},
					// {tit:'提单预算金额',val:'billBudgetAmount',type:'number'},
					// {tit:'合同计划日期',val:'contractDate'},
					// {tit:'合同执行日期',val:'contractExecuteDate'},
					// {tit:'合同计划金额',val:'contractAmount',type:'number'},
					// {tit:'合同预算金额',val:'contractBudgetAmount',type:'number'},
				],
				rows:[],
				investEntity:[],
				subInfoEntityList:[],
				subInfoPayEntityList:[],
				fileNo:[] //附件消息 
			}
		},
		onLoad() {
			 //获取流程页面的流程上下文[实用的流程信息从这里获取]
			  let billNo= window.parent.myvm.wfContext.BusinessKey;
			  this.fileNo = window.parent.myvm.wfContext.BusinessKey;
			  this.getlist(billNo)
		},
		mounted() {
			var that = this;
			window.myvm = that;
			window.$urlFormVue = that;
		},
		methods: {
			getlist(billNo){
				let _this = this
				const params = {
					billNo
				}
				_this.$lyRequest.get('/gateway/budget/mp/dbsap/investReview/queryDetail.do',
					params
				).then((result) => {
					if (result.success) {
						this.considerList(result.data.rows)
					} else {
						console.log(result.data.msg)
					}
				})
			},
			considerList(rows){
				this.rows = rows
				this.investEntity = rows.investEntity
				this.subInfoEntityList = rows.subInfoEntityList
				for(let i=0;i<this.subInfoEntityList.length;i++){
					let list = []
					list.push(rows.subInfoEntityList[i].subInfoPayEntityList)
					this.subInfoPayEntityList = list[0]
				}
			},
			//审批和驳回-工作流点击"提交"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			rejectWorkflow(btnDef) {
				return "";
			},
			//作废-工作流点击"作废"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//content为作废意见
			invalidWorkflow(content) {
				return "";
			},
			//转办-工作流点击"确认转办"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//opinion:转办意见
			referredWorkflow(opinion) {
				return "";
			},
			//校验-工作流点击"提交"时触校验函数，返回:true校验通过，false校验不通过；
			//也可以返回具体的错误信息：空字符串，校验通过，返回具体错误信息校验不通过，同时弹出具体的错误信息。
			validateWorkflowForm(btnDef,callback) {
				callback("");
			},
			//提交单据
			sendWorkflow(btnDef, callback) {
				callback("");
			},
			checkbtn(item) { //切换tabs
				if (item.index === 0) {
					this.commonApi.goAnchor('add_one')
				} else if (item.index === 1) {
					this.commonApi.goAnchor('add_two')
				} else if (item.index === 2) {
					this.commonApi.goAnchor('add_three')
				}
			},
		}
	}
</script>

<style scoped lang="scss">
view{
	font-family: pf;
}
.bodcolor{
		span{
			color:#ff6400;
			font-size: 36rpx;
			padding-right: 20rpx;
		}
		label{
			color: #ff6400;
		}
	}
	.bottom_setup {
		width: 100%;
		height: 160rpx;
		background-color: white;
		margin-top: 20rpx;
		padding: 35rpx 0;
		box-sizing: border-box;
		box-shadow: 5px -10rpx 5px 0px rgba(225, 225, 225, .4), ;
	
		.bottom_white1 {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			height: 100rpx;
	
			.custom-styles {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
			}
	
			.custom-style {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
				background-color: #007aff;
			}
		}
	}
	.sky{
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
		padding: 20rpx 40rpx;
		box-sizing: border-box;
		font-size: 36rpx;width: 95%;font-weight: bold;
	}
	.skyblue{
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
		padding: 20rpx 40rpx;
		box-sizing: border-box;
		width: 90%;
		background-color: rgb(247,250,255);
	}
	.newbord{
		width: 100%;margin: 0 auto;padding: 30rpx 0rpx;box-sizing: border-box;
		border-bottom: 10rpx solid rgb(248,249,251);
	}
</style>
